@extends('Admin.layouts.common')

@section('content')
    <div class="container" style="padding-top:20px;">

        @if(count($errors))
            <div class="alert alert-danger">
                <ul>
                    @foreach($errors->all() as $err)
                        <li>{{ $err }}</li>
                    @endforeach
                </ul>
            </div>
        @endif
        @if (Session::has('msg'))
            <div class="alert alert-success">
                <ul>
                        <li>{{ Session::get('msg') }}</li>
                </ul>
            </div>
        @endif
        <form method="post">
            {{ csrf_field() }}
            
            <div class="form-group required">
                <label class="control-label">原因</label>
                <select name="closure_rreason" class="form-control" onchange="change(this)">
                	@foreach($userdata_closure_rreason as $id=>$c)
                    <option value="{{ $c }}" @if($data->closure_rreason==$c)selected=""@endif>{{ $c }}</option>
                    @endforeach
                </select>
                <div id="other" style="display: none;">
                <label class="control-label">其它</label>
                <textarea name="other" class="form-control"></textarea>
            </div>
            </div>             
            <div class="form-group">
                <input type="hidden" name="status" value="{{$status}}">
                <button class="btn btn-primary btn-block" type="submit">保存</button>
            </div>
        </form>
    </div>
@endsection
@section('foot')
<script type="text/javascript">
    function change(obj){
        var val = $(obj).val();
        if(val=='其它'){
            $("#other").show();
        }else{
            $("#other").hide();
        }
    }
</script>

@endsection